<template>
  <div class="latexDiv" v-html="latex"></div>
</template>

<script>
import MathJax from '@/utils/MathJax'
export default {
  name: 'index',
  props:{latex:{type:String}},
  created() {
    this.mathJax()
  },
  watch:{
    latex(){
      this.mathJax()
    }
  },
  methods:{
    mathJax(){
      this.$nextTick(function(){
        if (MathJax.isMathjaxConfig){
          MathJax.initMathjaxConfig()
        }
        MathJax.MathQueue('latexDiv')
      })
    }
  }
}
</script>

<style scoped>

</style>
